//
//  ZJActivityCell.m
//  这家测试项目
//
//  Created by IOS_DEVELOPER on 2017/7/7.
//  Copyright © 2017年 陈志凌. All rights reserved.
//

#import "ZJActivityCell.h"

@implementation ZJActivityCell

- (void)awakeFromNib {
    [super awakeFromNib];

}

-(void)setModel:(ZJACModel *)model{
    _model = model;
    
    self.titleLabel.text = _model.title;
    self.timeLabel.text = _model.date;
    self.bgView.backgroundColor = [Utils colorWithHexString:[NSString stringWithFormat:@"#%@",_model.background]];
//    self.bgView.backgroundColor = [Utils colorWithHexString:@"6cabdf"];
    self.bgView.layer.shadowColor = RGB(235, 235, 235).CGColor;;
    self.bgView.layer.shadowOpacity = 0.8f;
    self.bgView.layer.shadowOffset = CGSizeMake(0,0.1);
    
    self.bgView.sd_layout.leftSpaceToView(self.contentView, 8).topSpaceToView(self.contentView, 0).rightSpaceToView(self.contentView, 8).bottomSpaceToView(self.contentView, 8);
    
    if (_model.date.length <= 0) {
        self.titleLabel.sd_layout.leftSpaceToView(self.bgView, 8).topSpaceToView(self.bgView, 64).rightSpaceToView(self.bgView, 8).autoHeightRatio(0);;
    }else{
        self.titleLabel.sd_layout.leftSpaceToView(self.bgView, 8).topSpaceToView(self.bgView, 50).rightSpaceToView(self.bgView, 8).autoHeightRatio(0);
    }
    self.timeLabel.sd_layout.leftSpaceToView(self.bgView, 8).topSpaceToView(self.titleLabel, 28).rightSpaceToView(self.bgView, 8).autoHeightRatio(0);
    
//    [self.bgView setupAutoHeightWithBottomView:self.timeLabel bottomMargin:8];
    [self.contentView setupAutoHeightWithBottomViewsArray:@[self.bgView,self.timeLabel,self.titleLabel] bottomMargin:8];

}

@end
